<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./lib/vue-2.4.0.js"></script>
    <style>
        .inner{
            height: 150px;
            background-color: darkcyan;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- .stop 阻止冒泡事件 -->
        <!-- <div class="inner" @click="divHandler">
            <input type="button" value="戳他" @click.stop="btnHandler">   
        </div> -->

        <!-- .prevent 阻止默认行为 -->
        <!-- <a href="http://www.baidu.com" @click.prevent="linkClick">百度一下</a> -->

        <!-- .capture 实现捕获触发事件的机制 -->
        <!-- <div class="inner" @click.capture="divHandler">
            <input type="button" value="戳他" @click.stop="btnHandler">   
        </div> -->

        <!-- .self 只有点击当前元素的时候才会触发事件 -->
        <!-- <div class="inner" @click.self="divHandler">
            <input type="button" value="戳他" @click.stop="btnHandler">   
        </div> -->

        <!-- .once 只触发一次事件 -->
        <a href="http://www.baidu.com" @click.prevent.once="linkClick">百度一下</a>
    </div>

    <script>
        var vm = new Vue({
            el : "#app",
            data : {

            },
            methods : {
                divHandler(){
                    console.log("触发了 inner div 的点击事件")
                },
                btnHandler(){
                    console.log("触发了 inner 按钮的点击事件")
                },
                linkClick(){
                    console.log("触发了 连接的点击事件")
                }
            }
        })
    </script>
</body>
</html>